# shellcheck disable=SC2034
uwsgi_path='cd /www/wwwroot/js-pc.jushichongdian.com/'



$uwsgi_path
if [ $? -eq 0 ]; then
    content="切换目录成功"
    echo -e "\033[32m $content \033[0m"
    while read pid
    do
      uwsgi_stop="sudo kill -9 $pid"
    done < uwsgi.pid
    $uwsgi_stop
    if [ $? -eq 0 ]; then
      content="关闭uwsgi成功"
      echo -e "\033[32m $content \033[0m"
      uwsgi_start='sudo uwsgi uwsgi.ini'
      sleep 1
        $uwsgi_start
        if [ $? -eq 0 ]; then
            content="启动uwsgi成功"
            echo -e "\033[32m $content \033[0m"
        else
            content="启动uwsgi失败"
            echo -e "\033[32m $content \033[0m"
        fi
    else
      content="关闭uwsgi失败"
      echo -e "\033[32m $content \033[0m"
      exit 1
    fi

else
    content="切换目录失败"
    echo -e "\033[32m $content \033[0m"
    exit 1
fi

